home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / ck5a189s / ckcmai.c < prev    next >
C/C++ Source or Header  |  1993-07-01  |  37KB  |  1,041 lines

  1. #ifndef MAC
  2. char *versio = "C-Kermit 5A(189), 30 June 93"; /* Version herald. */
  3. #else
  4. /*
  5.   For Macintosh, also remember to change the Mac-specific version in ckmkr2.r.
  6. */
  7. char *versio = "Mac Kermit 0.99(189) Pre-ALPHA, 30 June 93";
  8. #endif /* MAC */
  9. long vernum = 501189L;
  10. /*
  11.   String and numeric version numbers, keep these three in sync!
  12.   First digit of vermum = major version, i.e. 5.
  13.   Second 2 digits of vernum: 00 = no minor version, 01 = A, 02 = B, etc.
  14.   Last three digits are edit number. 
  15. */
  16. #ifndef VERWHO
  17. /* Change verwho in following line, or with -DVERWHO=x in makefile CFLAGS. */
  18. #define VERWHO 0
  19. #endif /* VERWHO */
  20. int verwho = VERWHO; /* Who produced this version, 0 = Columbia University */
  21. /*
  22.   IMPORTANT: If you are working on your own private version of C-Kermit, please
  23.   include some special notation, like your site name or your initials, in the
  24.   "versio" string, e.g. "5A(182)-XXX", and use a nonzero code for the "verwho"
  25.   variable (e.g. in the USA use your zip code).  Unless we stick to this
  26.   discipline, divergent copies of C-Kermit will begin to appear that are
  27.   intistinguishable from each other, which is a big support issue.  Also, if
  28.   you have edited C-Kermit and made copies available to others, please add
  29.   appropriate text to the BUG command (ckuus6.c, function dobug()).
  30. */
  31. #define CKCMAI
  32.  
  33. /*  C K C M A I  --  C-Kermit Main program  */
  34.  
  35. /*
  36.   Author: Frank da Cruz (fdc@columbia.edu, FDCCU@CUVMA.BITNET),
  37.   Columbia University Academic Information Systems, New York City.
  38.  
  39. COPYRIGHT NOTICE:
  40.  
  41.   Copyright (C) 1985, 1993, Trustees of Columbia University in the City of New
  42.   York.  The C-Kermit software may not be, in whole or in part, licensed or
  43.   sold for profit as a software product itself, nor may it be included in or
  44.   distributed with commercial products or otherwise distributed by commercial
  45.   concerns to their clients or customers without written permission of the
  46.   Office of Kermit Development and Distribution, Columbia University.  This
  47.   copyright notice must not be removed, altered, or obscured.
  48.  
  49. DOCUMENTATION:
  50.  
  51.   "Using C-Kermit" by Frank da Cruz and Christine M. Gianone,
  52.   Digital Press, Burlington, MA, USA.
  53.   Order Number: EY-J896E-DP
  54.   Digital Press ISBN: 1-55558-108-0
  55.   Prentice Hall ISBN: 0-13-037490-3
  56.   Order from DECdirect: +1 800 344-4825 (USA only)
  57.   Or from Columbia University: +1 212 854-3703
  58.  
  59. DISCLAIMER:
  60.  
  61.   The C-Kermit software is provided in source code form by Kermit Development
  62.   and Distribution, Columbia University.  The software is provided "as is;" no
  63.   other warranty is provided, express or implied, including without
  64.   limitations, any implied warranty of merchantability or implied warranty of
  65.   fitness for a particular purpose.
  66.  
  67.   Neither Columbia University nor any of the contributors to the C-Kermit
  68.   development effort, including, but not limited to, AT&T, Digital Equipment
  69.   Corporation, Data General Corporation, or International Business Machines
  70.   Corporation, warrant C-Kermit software or documentation in any way.  In
  71.   addition, neither the authors of any Kermit programs, publications or
  72.   documentation, nor Columbia University nor any contributing institutions or
  73.   individuals acknowledge any liability resulting from program or
  74.   documentation errors.
  75.  
  76. ACKNOWLEDGMENTS:
  77.  
  78.   The Kermit file transfer protocol was developed at the Columbia University
  79.   Center for Computing Activities (CUCCA).  It is named after Kermit the Frog,
  80.   star of the television series THE MUPPET SHOW; the name is used by permission
  81.   of Henson Associates, Inc.
  82.  
  83.   Thanks to at least the following people for their contributions to this
  84.   program over the years, and apologies to anybody I missed:
  85.  
  86.    Chris Adie, Edinburgh U, Scotland (OS/2 support)
  87.    Robert Adsett, University of Waterloo, Canada
  88.    Larry Afrin, Clemson U
  89.    Greg Andrews, Telebit Corp
  90.    Barry Archer, U of Missouri
  91.    Robert Andersson, International Systems A/S, Oslo, Norway
  92.    Chris Armstrong, Brookhaven National Lab (OS/2)
  93.    William Bader, Software Consulting Services, Nazareth, PA
  94.    Fuat Baran, CUCCA
  95.    Stan Barber, Rice U
  96.    Jim Barbour, U of Colorado
  97.    Donn Baumgartner, Dell
  98.    Nelson Beebe, U of Utah
  99.    Karl Berry, UMB
  100.    Dean W Bettinger, SUNY
  101.    Gary Bilkus
  102.    Marc Boucher, U of Montreal
  103.    Charles Brooks, EDN
  104.    Bob Brown
  105.    Mike Brown, Purdue U
  106.    Jack Bryans, California State U at Long Beach
  107.    Mark Buda, DEC (VAX/VMS)
  108.    Fernando Cabral, Padrao IX, Brasilia, Brazil
  109.    Bjorn Carlsson, Stockholm University Computer Centre QZ, Sweden
  110.    Bill Catchings, formerly of CUCCA
  111.    Bob Cattani, Columbia U CS Dept
  112.    Davide Cervone, Rochester University
  113.    Seth Chaiklin, Denmark
  114.    John Chandler, Harvard U / Smithsonian Astronomical Observatory
  115.    John L Chmielewski, AT&T, Lisle, IL
  116.    Howard Chu, U of Michigan
  117.    Bill Coalson, McDonnell Douglas
  118.    Bertie Coopersmith, London, UK
  119.    Chet Creider, University of Western Ontario, Canada
  120.    Alan Crosswell, CUCCA
  121.    Jeff Damens, formerly of CUCCA
  122.    Mark Davies, Bath U, UK
  123.    Sin-itirou Dezawa, Fujifilm, Japan
  124.    Joe R. Doupnik, Utah State U
  125.    Frank Dreano (Honeywell)
  126.    John Dunlap, University of Washington
  127.    David Dyck, John Fluke Mfg Co.
  128.    Stefaan A. Eeckels, Eurokom, Luxembourg
  129.    Paul Eggert, Twin Sun, Inc., El Segundo, CA
  130.    Bernie Eiben, DEC
  131.    Kristoffer Eriksson, Peridot Konsult AB, Oerebro, Sweden
  132.    John R. Evans, IRS, Kansas City
  133.    Glenn Everhart, RCA Labs
  134.    Charlie Finan, Cray Research
  135.    Herm Fischer, Encino, CA (extensive contributions to version 4.0)
  136.    Carl Fongheiser, CWRU
  137.    Marcello Frutig, Catholic University, Sao Paulo, Brazil (X.25 support)
  138.    Hirofumi Fujii, Japan Nat'l Lab for High Energy Physics, Tokyo (Kanji)
  139.    Chuck Fuller, Westinghouse Corporate Computer Services
  140.    Andy Fyfe, Caltech
  141.    Christine M. Gianone, CUCCA
  142.    John Gilmore, UC Berkeley
  143.    William H. Glass
  144.    German Goldszmidt, IBM
  145.    Alistair Gorman, New Zealand
  146.    Richard Gration, ADFA, Australia
  147.    Chris Green, Essex U, UK
  148.    Alan Grieg, Dundee Tech, Scotland, UK
  149.    Yekta Gursel, MIT
  150.    Jim Guyton, Rand Corp
  151.    Michael Haertel
  152.    Bob Hain, UMN
  153.    Marion Hakanson, ORST
  154.    John Hamilston, Iowa State U
  155.    Simon Hania, Netherlands
  156.    Stan Hanks, Rice U.
  157.    Ken Harrenstein, SRI
  158.    Eugenia Harris, Data General (AOS/VS)
  159.    David Harrison, Kingston Warren Corp
  160.    James Harvey, Indiana/Purdue U (VMS)
  161.    Rob Healey
  162.    Chuck Hedrick, Rutgers U
  163.    Ron Heiby, Technical Systems Division, Motorola Computer Group
  164.    Steve Hemminger, Tektronix
  165.    Christian Hemsing, RWTH Aachen, Germany (OS-9)
  166.    Andrew Herbert, Monash Univ, Australia
  167.    Mike Hickey, ITI
  168.    R E Hill
  169.    Bill Homer, Cray Research
  170.    Ray Hunter, The Wollongong Group
  171.    Randy Huntziger, National Library of Medicine
  172.    Larry Jacobs, Transarc
  173.    Steve Jenkins, Lancaster University, UK
  174.    Dave Johnson, Gradient Technologies
  175.    Mark B Johnson, Apple Computer
  176.    Eric F Jones, AT&T
  177.    Luke Jones, AT&T
  178.    Peter Jones, U of Quebec Montreal
  179.    Phil Julian, SAS Institute
  180.    Peter Kabal, U of Quebec
  181.    Mic Kaczmarczik, U of Texas at Austin
  182.    Sergey Kartashoff, Inst. of Precise Mechanics & Computer Equipment, Moscow
  183.    Howie Kaye, CUCCA
  184.    Rob Kedoin, Linotype Co, Hauppauge, NY (OS/2)
  185.    Mark Kennedy, IBM
  186.    Terry Kennedy, St Peter's College, Jersey City, NJ (VAX/VMS, 2.11 BSD)
  187.    Douglas Kingston, morgan.com
  188.    Lawrence Kirby, Wiltshire, UK
  189.    Tom Kloos, Sequent Computer Systems
  190.    Jim Knutson, U of Texas at Austin
  191.    Scott Kramer, SRI International, Menlo Park, CA
  192.    David Kricker, Encore Computer
  193.    Thomas Krueger, UWM
  194.    Bo Kullmar, Central Bank of Sweden, Kista
  195.    R. Brad Kummer, AT&T Bell Labs, Atlanta, GA
  196.    John Kunze, UC Berkeley
  197.    Bob Larson, USC (OS-9)
  198.    Bert Laverman, Groningen U, Netherlands
  199.    Steve Layton
  200.    David Lawyer, UC Irvine
  201.    David LeVine, National Semiconductor Corporation
  202.    Daniel S. Lewart, UIUC
  203.    S.O. Lidie, Lehigh U
  204.    Tor Lillqvist, Helsinki University, Finland
  205.    Dean Long
  206.    Kevin Lowey, U of Saskatchewan (OS/2)
  207.    Andy Lowry, Columbia University
  208.    David MacKenzie, Environmental Defense Fund, University of Maryland
  209.    John Mackin, University of Sidney, Australia
  210.    Martin Maclaren, Bath U, UK
  211.    Chris Maio, Columbia U CS Dept
  212.    Fulvio Marino, Olivetti, Ivrea, Italy
  213.    Peter Mauzey, AT&T
  214.    Tye McQueen, Utah State U
  215.    Ted Medin
  216.    Hellmuth Michaelis, Hanseatischer Computerservice GmbH, Hamburg, Germany
  217.    Leslie Mikesell, American Farm Bureau
  218.    Martin Minow, DEC (VAX/VMS)
  219.    Pawan Mistra, Bellcore
  220.    Ken Mizialko, IBM, Manassas, VA
  221.    Ray Moody, Purdue U
  222.    Bruce J Moore, Allen-Bradley Co, Highland Heights, OH (Atari ST)
  223.    Steve Morley, Convex
  224.    Peter Mossel, Columbia University
  225.    Tony Movshon, NYU
  226.    Lou Muccioli, Swanson Analysis Systems
  227.    Dan Murphy
  228.    Gary Mussar
  229.    John Nall, FSU
  230.    Jack Nelson, University of Pittsburgh
  231.    Jim Noble, Planning Research Corporation (Macintosh)
  232.    Ian O'Brien, Bath U, UK
  233.    John Owens
  234.    Michael Pins, Iowa Computer Aided Engineering Network
  235.    Andre' Pirard, University of Liege, Belgium
  236.    Paul Placeway, Ohio State U (Macintosh & more)
  237.    Piet W. Plomp, ICCE, Groningen University, Netherlands
  238.    Ken Poulton, HP Labs
  239.    Manfred Prange, Oakland U
  240.    Christopher Pratt, APV Baker, UK
  241.    Frank Prindle, NADC
  242.    Tony Querubin, U of Hawaii
  243.    Anton Rang
  244.    Scott Ribe
  245.    Alan Robiette, Oxford University, UK
  246.    Michel Robitaille, U of Montreal (Mac)
  247.    Kai Uwe Rommel, Technische Universitaet Muenchen (OS/2)
  248.    Larry Rosenman (Amiga)
  249.    Jay Rouman, U of Michigan
  250.    Jack Rouse, SAS Institute (Data General and/or Apollo)
  251.    Stew Rubenstein, Harvard U (VAX/VMS)
  252.    Bill Schilit, Columbia University
  253.    Michael Schmidt, U of Paderborn, Germany
  254.    Eric Schnoebelen, Convex
  255.    Benn Schreiber, DEC
  256.    Dan Schullman, DEC (modems, DIAL command, etc)
  257.    John Schultz, 3M
  258.    Steven Schultz, Contel (PDP-11)
  259.    APPP Scorer, Leeds Polytechnic, UK
  260.    Gordon Scott, Micro Focus, Newbury UK
  261.    Gisbert W. Selke, WIdO, Bonn, Germany
  262.    David Sizeland, U of London Medical School
  263.    Fridrik Skulason, Iceland
  264.    Dave Slate
  265.    Bradley Smith, UCLA
  266.    Fred Smith, Merk
  267.    Richard S Smith, Cal State
  268.    Ryan Stanisfer, UNT
  269.    Bertil Stenstroem, Stockholm University Computer Centre (QZ), Sweden
  270.    James Sturdevant, CAP GEMENI AMERICA, Minneapolis
  271.    Peter Svanberg, Royal Techn. HS, Sweden
  272.    James R. Swenson, Accu-Weather, Inc.
  273.    Andy Tanenbaum, Vrije U, Amsterdam, Netherlands
  274.    Markku Toijala, Helsinki U of Technology
  275.    Teemu Torma, Helsinki U of Technology
  276.    Rick Troxel, NIH
  277.    Warren Tucker, Tridom Corp, Mountain Park, GA
  278.    Dave Tweten, AMES-NAS
  279.    G Uddeborg, Sweden
  280.    Walter Underwood, Ford Aerospace
  281.    Pieter Van Der Linden, Centre Mondial, Paris
  282.    Ge van Geldorp, Netherlands
  283.    Fred van Kempen, MINIX User Group, Voorhout, Netherlands
  284.    Wayne Van Pelt, GE/CRD
  285.    Mark Vasoll, Oklahoma State U (V7 UNIX)
  286.    Konstantin Vinogradov, ICSTI, Moscow
  287.    Paul Vixie, DEC
  288.    Dimitri Vulis, CUNY
  289.    Roger Wallace, Raytheon
  290.    Stephen Walton, Calif State U, Northridge (Amiga)
  291.    Jamie Watson, Adasoft, Switzerland (RS/6000)
  292.    Rick Watson, U of Texas (Macintosh)
  293.    Robert Weiner, Programming Plus, New York City
  294.    Lauren Weinstein, Vortex Technlogy
  295.    David Wexelblat, AT&T
  296.    Joachim Wiesel, U of Karlsruhe
  297.    Lon Willett, U of Utah
  298.    Michael Williams, UCLA
  299.    Nate Williams, U of Montana
  300.    David Wilson
  301.    Patrick Wolfe, Kuck & Associates, Inc.
  302.    Gregg Wonderly, Oklahoma State U (V7 UNIX)
  303.    Farrell Woods, Concurrent (formerly Masscomp)
  304.    Dave Woolley, CAP Communication Systems, London
  305.    Jack Woolley, SCT Corp
  306.    Frank Wortner
  307.    Ken Yap, U of Rochester
  308.    John Zeeff, Ann Arbor, MI
  309. */
  310. /*
  311.   ckcsym.h is used for for defining symbols that normally would be defined
  312.   using -D or -d on the cc command line, for use with compilers that don't
  313.   support this feature.
  314. */
  315. #include "ckcsym.h"
  316. #include "ckcasc.h"            /* ASCII character symbols */
  317. #include "ckcdeb.h"            /* Debug & other symbols */
  318. #include "ckcker.h"            /* Kermit symbols */
  319. #include "ckcnet.h"            /* Network symbols */
  320. #ifndef NOSPL
  321. #include "ckuusr.h"
  322. #endif /* NOSPL */
  323.  
  324. #ifndef NOSERVER
  325. /* Text message definitions.. each should be 256 chars long, or less. */
  326. #ifdef MAC
  327. char *hlptxt = "\r\
  328. Mac Kermit Server Commands:\r\
  329. \r\
  330.     BYE\r\
  331.     FINISH\r\
  332.     GET filespec\r\
  333.     REMOTE CD directory\r\
  334.     REMOTE HELP\r\
  335.     SEND filespec\r\
  336. \r\0";
  337. #else
  338. #ifdef AMIGA
  339. char *hlptxt = "C-Kermit Server Commands:\n\
  340. \n\
  341. GET filespec, SEND filespec, FINISH, BYE, REMOTE HELP\n\
  342. \n\0";
  343. #else
  344. #ifdef OS2
  345. char *hlptxt = "C-Kermit Server REMOTE Commands:\n\
  346. \n\
  347. GET files  REMOTE CD [dir]     REMOTE DIRECTORY [files]\n\
  348. SEND files REMOTE SPACE [dir]  REMOTE HOST command\n\
  349. FINISH     REMOTE DELETE files REMOTE TYPE files\n\
  350. BYE        REMOTE HELP         REMOTE SET parameter value\n\
  351. \n\0";
  352. #else
  353. #ifdef MINIX
  354. char *hlptxt = "C-Kermit Server REMOTE Commands:\n\
  355. GET SEND BYE FINISH REMOTE: CD DEL DIR HELP HOST SET SPACE TYPE WHO\n\0";
  356. #else
  357. #ifdef VMS
  358. char *hlptxt = "C-Kermit Server REMOTE Commands:\r\n\
  359. \r\n\
  360. GET files  REMOTE CD [dir]     REMOTE DIRECTORY [files]\r\n\
  361. SEND files REMOTE SPACE [dir]  REMOTE HOST command\r\n\
  362. MAIL files REMOTE DELETE files REMOTE WHO [user]\r\n\
  363. BYE        REMOTE PRINT files  REMOTE TYPE files\r\n\
  364. FINISH     REMOTE HELP         REMOTE SET parameter value\r\n\
  365. \0";
  366. #else
  367. #ifdef datageneral
  368. char *hlptxt = "C-Kermit Server REMOTE Commands:\n\
  369. \n\
  370. GET files  REMOTE CD [dir]     REMOTE DIRECTORY [filespec]\n\
  371. SEND files REMOTE SPACE [dir]  REMOTE HOST command\n\
  372. BYE        REMOTE TYPE file    REMOTE DELETE files\n\
  373. FINISH     REMOTE WHO          REMOTE SET\n\
  374. \0";
  375. #else
  376. char *hlptxt = "C-Kermit Server REMOTE Commands:\n\
  377. \n\
  378. GET files  REMOTE CD [dir]     REMOTE DIRECTORY [files]\n\
  379. SEND files REMOTE SPACE [dir]  REMOTE HOST command\n\
  380. MAIL files REMOTE DELETE files REMOTE WHO [user]\n\
  381. BYE        REMOTE PRINT files  REMOTE TYPE files\n\
  382. FINISH     REMOTE HELP         REMOTE SET parameter value\n\
  383. \n\0";
  384. #endif
  385. #endif
  386. #endif
  387. #endif
  388. #endif
  389. #endif
  390.  
  391. #ifdef MINIX
  392. char *srvtxt = "\r\n\
  393. Entering server mode.\r\n\0";
  394. #else
  395. #ifdef OSK
  396. char *srvtxt = "\r\l\
  397. Entering server mode.  If your local Kermit software is menu driven, use\r\l\
  398. the menus to send commands to the server.  Otherwise, enter the escape\r\l\
  399. sequence to return to your local Kermit prompt and issue commands from\r\l\
  400. there.  Use SEND and GET for file transfer.  Use REMOTE HELP for a list of\r\l\
  401. other available services.  Use BYE or FINISH to end server mode.\r\l\0";
  402. #else /* UNIX, VMS, AOS/VS, and all others */
  403. char *srvtxt = "\r\n\
  404. Entering server mode.  If your local Kermit software is menu driven, use\r\n\
  405. the menus to send commands to the server.  Otherwise, enter the escape\r\n\
  406. sequence to return to your local Kermit prompt and issue commands from\r\n\
  407. there.  Use SEND and GET for file transfer.  Use REMOTE HELP for a list of\r\n\
  408. other available services.  Use BYE or FINISH to end server mode.\r\n\0";
  409. #endif /* OSK */
  410. #endif /* MINIX */
  411. #else  /* server mode disabled */
  412. char *srvtxt = "";
  413. #endif /* NOSERVER */
  414.  
  415. /* Declarations for Send-Init Parameters */
  416.  
  417. int spsiz = DSPSIZ,                     /* Current packet size to send */
  418.     spmax = DSPSIZ,            /* Biggest packet size we can send */
  419.     spsizr = DSPSIZ,            /* Send-packet size requested */
  420.     spsizf = 0,                         /* Flag to override size negotiation */
  421.     rpsiz = DRPSIZ,                     /* Biggest we want to receive */
  422.     urpsiz = DRPSIZ,            /* User-requested receive pkt size */
  423.     maxrps = MAXRP,            /* Maximum incoming long packet size */
  424.     maxsps = MAXSP,            /* Maximum outbound l.p. size */
  425.     maxtry = MAXTRY,            /* Maximum retries per packet */
  426.     wslots = 1,                /* Window size currently in use */
  427.     wslotr = 1,                /* Window size from SET WINDOW */
  428.     wslotn = 1,                /* Window size negotiated in S-pkt */
  429.     timeouts = 0,            /* For statistics reporting */
  430.     spackets = 0,            /*  ... */
  431.     rpackets = 0,            /*  ... */
  432.     retrans = 0,            /*  ... */
  433.     crunched = 0,            /*  ... */
  434.     wmax = 0,                /*  ... */
  435.     wcur = 0,                /*  ... */
  436.     srvdis = 0,                /* Server file xfer display */
  437.     srvtim = DSRVTIM,            /* Server command wait timeout */
  438. /*
  439.   timint is the timeout interval I use when waiting for a packet.
  440.   pkttim is the SET RECEIVE TIMEOUT value, sent to the other Kermit.
  441.   rtimo is the SET SEND TIMEOUT value.  rtimo is the initial value of
  442.   timint.  timint is changed by the value in the incoming negotiation
  443.   packet unless a SET SEND TIMEOUT command was given.
  444. */
  445.     timint = DMYTIM,                    /* Timeout interval I use */
  446.     pkttim = URTIME,            /* Timeout I want you to use */
  447.     rtimo = DMYTIM,            /* Normal packet wait timeout */
  448.     timef = 0,                          /* Flag to override what you ask */
  449.     npad = MYPADN,                      /* How much padding to send */
  450.     mypadn = MYPADN,                    /* How much padding to ask for */
  451.     bctr = 1,                           /* Block check type requested */
  452.     bctu = 1,                           /* Block check type used */
  453.     bctl = 1,                /* Block check length */
  454.     ebq =  MYEBQ,                       /* 8th bit prefix */
  455.     ebqflg = 0,                         /* 8th-bit quoting flag */
  456.     rqf = -1,                /* Flag used in 8bq negotiation */
  457.     rq = 0,                /* Received 8bq bid */
  458.     sq = 'Y',                /* Sent 8bq bid */
  459.     rpt = 0,                            /* Repeat count */
  460.     rptq = MYRPTQ,                      /* Repeat prefix */
  461.     rptflg = 0,                         /* Repeat processing flag */
  462.     rptena = 1,                /* Repeat processing enabled */
  463.     xfrcan = 1,                /* Transfer cancellation enabled */
  464.     xfrchr = 3,                /* Transfer cancel char = Ctrl-C */
  465.     xfrnum = 2;                /* Need two of them. */
  466.  
  467. int capas = 9,                /* Position of Capabilities */
  468.     atcapb = 8,                /* Attribute capability */
  469.     atcapr = 1,                /*  requested */
  470.     atcapu = 0,                /*  used */
  471.     swcapb = 4,                /* Sliding Window capability */
  472.     swcapr = 1,                /*  requested (allowed) */
  473.     swcapu = 0,                /*  used */
  474.     lpcapb = 2,                /* Long Packet capability */
  475.     lpcapr = 1,                /*  requested */
  476.     lpcapu = 0,                /*  used */
  477.     lscapb = 32,            /* Locking Shift capability */
  478.     lscapr = 1,                /*  requested by default */
  479.     lscapu = 0;                /*  used */
  480.  
  481. /* Flags for whether to use particular attributes */
  482.  
  483. int atenci = 1,                /* Encoding in */
  484.     atenco = 1,                /* Encoding out */
  485.     atdati = 1,                /* Date in */
  486.     atdato = 1,                /* Date out */
  487.     atdisi = 1,                /* Disposition in/out */
  488.     atdiso = 1,
  489.     atleni = 1,                /* Length in/out (both kinds) */
  490.     atleno = 1,
  491.     atblki = 1,                /* Blocksize in/out */
  492.     atblko = 1,
  493.     attypi = 1,                /* File type in/out */
  494.     attypo = 1,
  495.     atsidi = 1,                /* System ID in/out */
  496.     atsido = 1,
  497.     atsysi = 1,                   /* System-dependent parameters in/out */
  498.     atsyso = 1;
  499.  
  500. CHAR padch = MYPADC,                    /* Padding character to send */
  501.     mypadc = MYPADC,                    /* Padding character to ask for */
  502.     seol = MYEOL,                       /* End-Of-Line character to send */
  503.     eol = MYEOL,                        /* End-Of-Line character to look for */
  504.     ctlq = CTLQ,                        /* Control prefix in incoming data */
  505.     myctlq = CTLQ,                      /* Outbound control character prefix */
  506.     myrptq = MYRPTQ;            /* Repeat prefix I want to use */
  507.  
  508. int rptmin = 3;                /* Repeat-count minimum */
  509.  
  510. struct zattr iattr;            /* Incoming file attributes */
  511.  
  512. /* File related variables, mainly for the benefit of VAX/VMS */
  513.  
  514. int fblksiz = DBLKSIZ;        /* File blocksize */
  515. int frecl = DLRECL;        /* File record length */
  516. int frecfm = XYFF_S;        /* File record format (default = stream) */
  517. int forg = XYFO_S;        /* File organization (sequential) */
  518. int fcctrl = XYFP_N;        /* File carriage control (ctrl chars) */
  519.  
  520. #ifdef VMS
  521. /* VMS labeled file options */
  522. int lf_opts = LBL_NAM;
  523. #else
  524. int lf_opts = 0;
  525. #endif /* VMS */
  526.  
  527. /* Packet-related variables */
  528.  
  529. int pktnum = 0,                         /* Current packet number */
  530.     sndtyp = 0,                /* Type of packet just sent */
  531.     rcvtyp = 0,                /* Type of packet just received */
  532.     rsn,                /* Received packet sequence number */
  533.     rln,                /* Received packet length */
  534.     size,                               /* Current size of output pkt data */
  535.     osize,                              /* Previous output packet data size */
  536.     maxsize,                            /* Max size for building data field */
  537.     spktl = 0,                /* Length packet being sent */
  538.     rpktl = 0,                /* Length of packet just received */
  539.     rprintf,                /* REMOTE PRINT flag */
  540.     rmailf;                /* MAIL flag */
  541.  
  542. CHAR
  543. #ifdef NO_MORE  /* Buffers used before sliding windows... */
  544.     sndpkt[MAXSP+100],            /* Entire packet being sent */
  545.     recpkt[MAXRP+200],            /* Packet most recently received */
  546.     data[MAXSP+4],            /* Packet data buffer */
  547. #endif
  548. #ifdef DYNAMIC
  549.     *srvcmd = (CHAR *)0,        /* Where to decode server command */
  550. #else
  551.     srvcmd[MAXRP+4],                    /* Where to decode server command */
  552. #endif
  553.     padbuf[95],                /* Buffer for send-padding */
  554.     *recpkt,
  555.     *rdatap,                /* Pointer to received packet data */
  556.     *data = (CHAR *)0,            /* Pointer to send-packet data */
  557.     *srvptr,                            /* Pointer to srvcmd */
  558.     mystch = SOH,                       /* Outbound packet-start character */
  559.     stchr = SOH;                        /* Incoming packet-start character */
  560.  
  561. /* File-related variables */
  562.  
  563. char filnam[257];                       /* Name of current file. */
  564. char cmdfil[80];            /* Application file name. */
  565.  
  566. int nfils = 0;                /* Number of files in file group */
  567. long fsize;                             /* Size of current file */
  568. int wildxpand = 0;            /* Who expands wildcards */
  569. int clfils = 0;                /* Flag for command-line files */
  570. int stayflg = 0;            /* Flag for "stay", i.e. "-S" */
  571.  
  572. /* Communication line variables */
  573.  
  574. char ttname[80];                        /* Name of communication line. */
  575.  
  576. #ifdef MAC
  577. int connected = 0;            /* true if connected */
  578. int startconnected;            /* initial state of connected */
  579. #endif /* MAC */
  580.  
  581. long speed = -1L;            /* Line speed */
  582.  
  583. int parity = DEFPAR,            /* Parity specified, 0,'e','o',etc */
  584.     autopar = 0,            /* Automatic parity change flag */
  585.     sosi = 0,                /* Shift-In/Out flag */
  586.     flow,                               /* Flow control */
  587.     turn = 0,                           /* Line turnaround handshake flag */
  588.     turnch = XON,                       /* Line turnaround character */
  589.     duplex = 0,                         /* Duplex, full by default */
  590.     escape = DFESC,            /* Escape character for connect */
  591.     delay = DDELAY,                     /* Initial delay before sending */
  592.     tnlm = 0,                /* Terminal newline mode */
  593.     mdmtyp = 0;                         /* Modem type (initially none)  */
  594.  
  595. /* Networks for SET HOST */
  596.  
  597. #define MYHOSTL 100
  598.     char myhost[MYHOSTL];        /* Local host name */
  599.     int network = 0;            /* Network vs serial connection */
  600.  
  601. #ifdef NETCONN
  602. #ifdef TCPSOCKET
  603.     int nettype = NET_TCPB;        /* Assume TCP/IP (BSD sockets) */
  604. #else
  605. #ifdef SUNX25
  606.     int nettype = NET_SX25;
  607. #else
  608. #ifdef DECNET
  609.     int nettype = NET_DEC;
  610. #else
  611.     int nettype = NET_NONE;
  612. #endif /* DECNET */
  613. #endif /* SUNX25 */
  614. #endif /* TCPSOCKET */
  615. #else
  616.     int nettype = NET_NONE;
  617. #endif /* NETCONN */
  618.  
  619. #ifdef SUNX25
  620.     extern initpad();
  621.     int revcall = 0;            /* X.25 reverse call not selected */
  622.     int closgr  = -1;        /* X.25 closed user group not selected */
  623.     int cudata = 0;        /* X.25 call user data not specified */
  624.     char udata[MAXCUDATA];    /* X.25 call user data */
  625. #endif /* SUNX25 */
  626.  
  627. /* Other recent additions */
  628.  
  629.     int tlevel = -1;            /* Take-file command level */
  630. #ifndef NOSPL
  631.     extern int cmdlvl;            /* Command level */
  632.     extern int maclvl;            /* Macro invocation level */
  633. #endif /* NOSPL */
  634.     int carrier = CAR_AUT;        /* Pay attention to carrier signal */
  635.     int cdtimo = 0;            /* Carrier wait timeout */
  636.     int xitsta = GOOD_EXIT;        /* Program exit status */
  637. #ifdef VMS                /* Default filename collision action */
  638.     int fncact = XYFX_X;        /* REPLACE for VAX/VMS */
  639. #else
  640.     int fncact = XYFX_B;        /* BACKUP for everybody else */
  641. #endif /* VMS */
  642.     int bgset = -1;            /* BACKGROUND mode set explicitly */
  643. #ifdef UNIX
  644.     int suspend = DFSUSP;        /* Whether SUSPEND command, etc, */
  645. #else                    /* is to be allowed. */
  646.     int suspend = 0;
  647. #endif /* UNIX */
  648.  
  649. /* Statistics variables */
  650.  
  651. long filcnt,                    /* Number of files in transaction */
  652.     flci,                       /* Characters from line, current file */
  653.     flco,                       /* Chars to line, current file  */
  654.     tlci,                       /* Chars from line in transaction */
  655.     tlco,                       /* Chars to line in transaction */
  656.     ffc,                        /* Chars to/from current file */
  657.     tfc,                        /* Chars to/from files in transaction */
  658.     rptn;            /* Repeated characters compressed */
  659.  
  660. int tsecs = 0;                  /* Seconds for transaction */
  661. int fsecs = 0;            /* Per-file timer */
  662.  
  663. /* Flags */
  664.  
  665. int deblog = 0,                         /* Flag for debug logging */
  666.     debses = 0,                /* Flag for DEBUG SESSION */
  667.     pktlog = 0,                         /* Flag for packet logging */
  668.     seslog = 0,                         /* Session logging */
  669.     tralog = 0,                         /* Transaction logging */
  670.     displa = 0,                         /* File transfer display on/off */
  671.     stdouf = 0,                         /* Flag for output to stdout */
  672.     stdinf = 0,                /* Flag for input from stdin */
  673.     xflg   = 0,                         /* Flag for X instead of F packet */
  674.     hcflg  = 0,                         /* Doing Host command */
  675.     fncnv  = 1,                         /* Flag for file name conversion */
  676.     binary = 0,                         /* Flag for binary file */
  677.     savmod = 0,                         /* Saved file mode (whole session) */
  678.     bsave  = 0,                /* Saved file mode (per file) */
  679.     bsavef = 0,                /* Flag if bsave was used. */
  680.     cmask  = 0177,            /* Connect byte mask */
  681.     fmask  = 0377,            /* File byte mask */
  682.     warn   = 0,                         /* Flag for file warning */
  683.     quiet  = 0,                         /* Be quiet during file transfer */
  684.     local  = 0,                         /* Flag for external tty vs stdout */
  685.     server = 0,                         /* Flag for being a server */
  686.     cflg   = 0,                /* Connect before transaction */
  687.     cnflg  = 0,                         /* Connect after transaction */
  688.     cxseen = 0,                         /* Flag for cancelling a file */
  689.     czseen = 0,                         /* Flag for cancelling file group */
  690.     discard = 0,            /* Flag for file to be discarded */
  691.     keep = 0,                           /* Keep incomplete files */
  692.     unkcs = 1,                /* Keep file w/unknown character set */
  693.     nakstate = 0,            /* In a state where we can send NAKs */
  694.     dblchar = -1;            /* Character to double when sending */
  695.  
  696. /* Variables passed from command parser to protocol module */
  697.  
  698. #ifndef NOSPL
  699. _PROTOTYP( int parser, (int) );         /* The parser itself */
  700. char *clcmds = NULL;            /* Pointer to command-line commands */
  701. #endif /* NOSPL */
  702.  
  703. CHAR sstate  = (CHAR) 0;                /* Starting state for automaton */
  704. CHAR zstate  = (CHAR) 0;        /* For remembering sstate */
  705. char *cmarg  = "";                      /* Pointer to command data */
  706. char *cmarg2 = "";                      /* Pointer to 2nd command data */
  707. char **cmlist;                          /* Pointer to file list in argv */
  708.  
  709. /* Flags for the ENABLE and DISABLE commands */
  710.  
  711. int en_cwd = 1;                /* CD/CWD */
  712. int en_del = 1;                /* DELETE */
  713. int en_dir = 1;                /* DIRECTORY */
  714. int en_fin = 1;                /* FINISH/BYE */
  715. int en_get = 1;                /* GET */
  716. #ifndef NOPUSH
  717. int en_hos = 1;                /* HOST enabled */
  718. #else
  719. int en_hos = 0;                /* HOST disabled */
  720. #endif /* NOPUSH */
  721. int en_sen = 1;                /* SEND */
  722. int en_set = 1;                /* SET */
  723. int en_spa = 1;                /* SPACE */
  724. int en_typ = 1;                /* TYPE */
  725. int en_who = 1;                /* WHO */
  726. #ifdef datageneral
  727. /* Data General AOS/VS can't do this */
  728. int en_bye = 0;                /* BYE */
  729. #else
  730. int en_bye = 1;                /* BYE */
  731. #endif /* datageneral */
  732.  
  733. /* Miscellaneous */
  734.  
  735. char **xargv;                           /* Global copies of argv */
  736. int  xargc;                             /* and argc  */
  737. int xargs;                /* an immutable copy of argc */
  738. char *xarg0;                /* and of argv[0] */
  739.  
  740. extern char *dftty;                     /* Default tty name from ck?tio.c */
  741. extern int dfloc;                       /* Default location: remote/local */
  742. extern int dfprty;                      /* Default parity */
  743. extern int dfflow;                      /* Default flow control */
  744.  
  745. /*
  746.   Buffered file input and output buffers.  See getpkt() in ckcfns.c
  747.   and zoutdump() in the system-dependent file i/o module (usually ck?fio.c).
  748. */
  749. #ifndef DYNAMIC
  750. /* Now we allocate them dynamically, see getiobs() below. */
  751. char zinbuffer[INBUFSIZE], zoutbuffer[OBUFSIZE];
  752. #endif
  753. char *zinptr, *zoutptr;
  754. int zincnt, zoutcnt;
  755.  
  756. _PROTOTYP( int getiobs, (void) );
  757.  
  758. /*  M A I N  --  C-Kermit main program  */
  759.  
  760. #ifndef NOCCTRAP
  761. #include <setjmp.h>
  762. extern jmp_buf cmjbuf;
  763. #ifdef GEMDOS                /* Special for Atari ST */
  764.     cc_clean();
  765. #endif /* GEMDOS */
  766. #endif /* NOCCTRAP */
  767.  
  768. #ifdef aegis
  769. /* On the Apollo, intercept main to insert a cleanup handler */
  770. int
  771. ckcmai(argc,argv) int argc; char **argv;
  772. #else
  773. #ifdef MAC                /* Macintosh */
  774. int
  775. main (void)
  776. #else
  777. #ifdef VMSGCC                /* (Open)VMS with GCC compiler */
  778. int
  779. main(argc,argv) int argc; char **argv;
  780. #else
  781. #ifdef __DECC                /* Alpha AXP with DEC C compiler */
  782. #ifdef __ALPHA
  783. int
  784. main(argc,argv) int argc; char **argv;
  785. #else                    /* DEC C compiler, not Alpha AXP */
  786. VOID
  787. main(argc,argv) int argc; char **argv;
  788. #endif    /* __ALPHA */
  789. #else                    /* All others */
  790. VOID
  791. main(argc,argv) int argc; char **argv;
  792. #endif /* __DECC */
  793. #endif /* VMSGCC */
  794. #endif /* MAC */
  795. #endif /* aegis */
  796. { /* main */
  797. #ifdef datageneral
  798. short *pfha = 016000000036;             /* Get around LANG_RT problem -- */
  799. *pfha = (short) 0;                      /* No user protection fault handler */
  800. #endif /* datageneral */
  801.   
  802. /* Do some initialization */
  803.  
  804.     if (sysinit() < 0)            /* System-dependent initialization. */
  805.       fatal("Can't initialize!");
  806.     connoi();                /* Console interrupts off */
  807. #ifndef MAC
  808.     xargc = xargs = argc;        /* Make global copies of argc */
  809.     xargv = argv;                       /* ...and argv. */
  810.     xarg0 = argv[0];
  811. #endif /* MAC */
  812.     sstate = 0;                         /* No default start state. */
  813. #ifdef DYNAMIC
  814.     if (getiobs() < 0)
  815.       fatal("Can't allocate i/o buffers!");
  816. #endif /* DYNAMIC */
  817.     ckhost(myhost,MYHOSTL);        /* Name of local host */
  818.     strcpy(ttname,dftty);               /* Set up default tty name. */
  819.     local = dfloc;                      /* And whether it's local or remote. */
  820.     parity = dfprty;                    /* Set initial parity, */
  821.     flow = dfflow;                      /* and flow control. */
  822.     if (local) if (ttopen(ttname,&local,0,0) < 0) { /* If default tty line */
  823. #ifndef OS2
  824.     printf("%s: Can't open device\n",ttname);   /* is external, open it */
  825. #endif /* OS2 */
  826.     local = 0;                        /* now... */
  827.     strcpy(ttname,CTTNAM);
  828.     }
  829.     speed = ttgspd();            /* Get transmission speed. */
  830.  
  831. #ifdef SUNX25
  832.     initpad();                          /* Initialize X.25 PAD */
  833. #endif /* SUNX25 */
  834.  
  835.     if (inibufs(SBSIZ,RBSIZ) < 0)    /* Allocate packet buffers */
  836.       fatal("Can't allocate packet buffers!");
  837.  
  838. #ifndef NOICP
  839. #ifdef MAC
  840.     cmdini();
  841. #else /* Not MAC */
  842. /* Attempt to take ini file before doing command line */
  843.  
  844.     *cmdfil = '\0';            /* Assume no command file. */
  845.     prescan();                /* But first check for -y option */
  846.  
  847. #ifndef NOCCTRAP
  848.     setint();                /* Set up interrupts */
  849.     if (setjmp(cmjbuf)) {        /* Control-C trap returns to here. */
  850. #ifdef GEMDOS
  851.     cc_clean();            /* Atari: Clean up after ^C-trap. */
  852. #endif /* GEMDOS */
  853.     doexit(GOOD_EXIT,-1);        /* Exit with good status. */
  854.     } else {
  855. #endif /* NOCCTRAP */
  856.     cmdini();            /* Sets tlevel */
  857.     while (tlevel > -1) {        /* Execute init file. */
  858.         sstate = parser(0);        /* Loop getting commands. */
  859.         if (sstate) proto();    /* Enter protocol if requested. */
  860.     }
  861. #ifndef NOCCTRAP
  862.     }
  863. #endif /* NOCCTRAP */
  864.  
  865. /*
  866.   In UNIX there are two ways to invoke Kermit with a cmdfile:
  867.   (1) From the kermit command line, e.g. "kermit cmdfile [ options... ]"
  868.       argv[0] = "kermit"
  869.       argv[1] = "cmdfile"
  870.   (2) By executing a cmdfile whose first line is like "#!/path/kermit"
  871.       argv[0] = "/path/kermit" (sometimes just "kermit")
  872.       argv[1] = "/path/cmdfile"
  873. */
  874.     if (argc > 1) {
  875.     if (*argv[1] != '-') {
  876.         if (zchki(argv[1]) > 0) {
  877.         strcpy(cmdfil,argv[1]);
  878.         }
  879.     }
  880.     }
  881.     if (*cmdfil) {            /* If we got one, */
  882.     dotake(cmdfil);            /* execute it */
  883.     while (tlevel > -1) {        /* until it runs out. */
  884.         sstate = parser(1);        /* Loop getting commands. */
  885.         if (sstate) proto();    /* Enter protocol if requested. */
  886.     }
  887.     }
  888.     *cmdfil = '\0';            /* Done, nullify the file name */
  889. #endif /* MAC */
  890. #endif /* NOICP */
  891.  
  892. #ifndef NOCMDL
  893. /* Look for a UNIX-style command line... */
  894.  
  895.     if (argc > 1) {                     /* Command line arguments? */
  896.         sstate = cmdlin();              /* Yes, parse. */
  897.     zstate = sstate;        /* Remember sstate around protocol */
  898.     if (cflg) conect();        /* Connect first if requested */
  899.         if (sstate) {
  900.         if (displa) concb((char)escape); /* (for console "interrupts") */
  901. #ifndef NOCCTRAP
  902.         setint();            /* Set up interrupts */
  903.         if (setjmp(cmjbuf)) {    /* Control-C trap returns to here. */
  904. #ifdef GEMDOS
  905.         cc_clean();
  906. #endif /* GEMDOS */
  907.         if (cnflg) conect();    /* connect again if requested, */
  908.         } else {
  909. #endif /* NOCCTRAP */
  910.         proto();        /* Take any requested action, then */
  911.         if (!quiet)        /* put cursor back at left margin, */
  912.           conoll("");
  913.         if (cnflg) conect();    /* connect if requested, */
  914. #ifndef NOCCTRAP
  915.         }
  916. #endif /* NOCCTRAP */
  917.     }
  918. /*
  919.   If interactive commands were given on the command line (using the
  920.   -C "command, command, ..." option), assign them to a macro called
  921.   "cl_commands", then execute the macro and leave it defined for
  922.   subsequent re-execution if desired.
  923. */
  924. #ifndef NOSPL
  925.     if (clcmds) {            /* Check for -C commands */
  926.         int x;
  927.         x = addmac("cl_commands",clcmds); /* Put macro in table */
  928.         if (x > -1) {        /* If successful, */
  929.         dodo(x,NULL);        /* set up for macro execution */
  930.         while (maclvl > -1) {    /* Loop getting macro commands. */
  931.             sstate = parser(1);
  932.             if (sstate) proto(); /* Enter protocol if requested. */
  933.         }
  934.         }
  935.     }
  936. #endif /* NOSPL */
  937. #ifndef NOICP
  938. /*
  939.   If a command-line action argument was given and -S ("stay") was not given,
  940.   exit now.
  941. */
  942.     if ((cflg || cnflg || zstate) && !stayflg)
  943. #endif /* NOICP */
  944.       doexit(GOOD_EXIT,xitsta); /* exit with good status */
  945.     }
  946. #endif /* NOCMDL */
  947.  
  948. #ifdef NOICP                /* No interactive command parser */
  949.     else {
  950. #ifndef NOCMDL
  951.     usage();            /* Command-line-only version */
  952.     doexit(BAD_EXIT,-1);
  953. #else                    /* Neither one! */
  954.     doexit(BAD_EXIT,-1);
  955. #endif /* NOCMDL */
  956.     }
  957. #else /* not NOICP */
  958. /*
  959.   If no action requested on command line, or if -S ("stay") was included,
  960.   enter the interactive command parser.
  961. */
  962.     herald();                /* Display program herald. */
  963.  
  964. #ifndef NOCCTRAP            /* If not no Control-C trap */
  965. ccagain:
  966.     if (setjmp(cmjbuf)) {        /* Control-C trap returns to here. */
  967. #ifdef GEMDOS
  968.     cc_clean();
  969. #endif /* GEMDOS */
  970.     fixcmd();            /* Pop command stacks, etc. */
  971.     debug(F100,"ckcmai got interrupt","",0);
  972.     goto ccagain;            /* set up trap again. */
  973.     } else {
  974.     debug(F100,"ckcmai setting interrupt trap","",0);
  975.     setint();            /* Set up command interrupt traps */
  976.     }
  977. #else /* NOCCTRAP */
  978.     setint();                /* Set up command interrupt traps */
  979. #endif /* NOCCTRAP */
  980.  
  981. #ifdef MAC
  982.     while (1) {
  983.     extern char *lfiles;        /* fake pointer cast */
  984.  
  985.     if (connected) {
  986.         debug(F100, "main: calling macparser", "", 0);
  987.         sstate = newparser(1, 1, 0L);
  988.  
  989.         /* ignore null command state */
  990.         if (sstate == 'n')
  991.         sstate = '\0';
  992.  
  993.         if (sstate)
  994.         proto();
  995.     }
  996.     else {
  997.         /*
  998.          * process take files the finder gave us.
  999.          */
  1000.         if ((tlevel == -1) && lfiles)
  1001.         startlfile();
  1002.  
  1003.         debug(F100, "main: calling parser", "", 0);
  1004.         sstate = parser(0);
  1005.         if (sstate == 'c')        /* if MAC connect */
  1006.         sstate = 0;
  1007.         if (sstate)
  1008.         proto();
  1009.     }
  1010.     }
  1011. #else /* Not MAC */
  1012.  
  1013. /*
  1014.   Running from an application file, or a command filename was
  1015.   specified on the command line.
  1016. */
  1017.     if (*cmdfil) dotake(cmdfil);    /* Command file spec'd on cmd line */
  1018.     while(1) {                /* Loop getting commands. */
  1019.     sstate = parser(0);
  1020.         if (sstate) proto();            /* Enter protocol if requested. */
  1021.     }
  1022. #endif /* MAC */
  1023. #endif /* NOICP */
  1024. }
  1025.  
  1026. #ifdef DYNAMIC
  1027. /* Allocate file i/o buffers */
  1028.  
  1029. char *zinbuffer, *zoutbuffer;
  1030.  
  1031. int
  1032. getiobs() {
  1033.     zinbuffer = (char *)malloc(INBUFSIZE);
  1034.     if (!zinbuffer) return(-1);
  1035.     zoutbuffer = (char *)malloc(OBUFSIZE);
  1036.     if (!zoutbuffer) return(-1);
  1037.     debug(F100,"getiobs ok","",0);
  1038.     return(0);
  1039. }
  1040. #endif /* DYNAMIC */
  1041.